package com.gthncz;

import java.util.*;

// Solution
public class Main5 {

    private int[][] dp;

    private int dfs(int m, int n, int i, int j) {
        if (i == n-1 && j == m-1) {
            // 到达右下角
            dp[i][j] = 0;
            return 1;
        } else if (i == m || j == n) {
            // 越界情况
            return 0;
        }

        // int result = dfs(m, n, i, j+1) + dfs(m, n, i+1, j);
        int result = 0;
        if (i < n && j+1 < m) {
            if (dp[i][j+1] != 0) result += dp[i][j+1];
            else  result += dfs(m, n, i, j+1);
        }

        if (i+1 < n && j < m){
            if (dp[i+1][j] != 0) result += dp[i+1][j];
            else result += dfs(m, n, i+1, j);
        }

        dp[i][j] = result;
        return result;
    }

    /**
     *
     * @param m int整型
     * @param n int整型
     * @return int整型
     */
    public int paths (int m, int n) {
        if (m <= 0 || n <= 0) return 0;
        dp = new int[n][m];
        return dfs(m, n, 0, 0);
    }


    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {// 注意，如果输入是多个测试用例，请通过while循环处理多个测试用例
            int m = sc.nextInt();
            int n = sc.nextInt();

            int result = (new Main5()).paths(m, n);
            System.out.printf("%d", result);
        }
    }
}